package com.objectproject.main.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.objectproject.main.dao.MyObjectDAOImpl;
import com.objectproject.main.dao.MyObjectHierarchyDAOImpl;
import com.objectproject.main.dao.MyPrimitiveDAOImpl;
import com.objectproject.main.dao.MyPropertyDAOImpl;
import com.objectproject.main.dao.MyUserDAOImpl;
import com.objectproject.main.model.MyUser;
import com.objectproject.main.service.iface.MyUserService;
import com.objectproject.main.service.subsystem.MyLocaleResolver;
import com.objectproject.main.service.subsystem.MyObjectHierarchyResolver;
import com.objectproject.main.service.subsystem.PrimitiveRenderer;
import com.objectproject.main.service.subsystem.loader.PropertyDetailLoader;
import com.objectproject.main.service.subsystem.loader.PropertyLoader;
import com.objectproject.main.service.subsystem.loader.ValueLoader;
import com.objectproject.main.service.subsystem.utility.PropertyUtility;

@Service
public class MyUserServiceImpl implements MyUserService {

	@Autowired
	MyObjectDAOImpl myObjectDAOImpl;
	
	@Autowired
	MyUserDAOImpl myUserDAOImpl;
	
	@Autowired
	MyPropertyDAOImpl myPropertyDAOImpl;
	
	@Autowired
	MyPrimitiveDAOImpl myPrimitiveDAOImpl;
	
	@Autowired
	MyLocaleResolver myLocaleResolver;
	
	@Autowired
	MyPropertyServiceImpl myPropertyServiceImpl;
	
	@Autowired
	MyObjectHierarchyDAOImpl myObjectHierarchyDAOImpl;
	
	@Autowired
	MyObjectHierarchyResolver myObjectHierarchyResolver;
	
	@Autowired
	PropertyUtility propertyUtility;
	
	@Autowired
	PropertyLoader propertyLoader;
	
	@Autowired
	PropertyDetailLoader propertyDetailLoader;
	
	@Autowired
	ValueLoader valueLoader;
	
	@Autowired
	PrimitiveRenderer primitiveRenderer;

	@Override
	@Transactional(propagation=Propagation.REQUIRED)
	public long addMyUser(MyUser myUser) {
		long insertedId = myUserDAOImpl.insertMyUser(myUser);
		return insertedId;
	}

	@Override
	@Transactional(propagation=Propagation.REQUIRED)
	public void removeMyUser(long userId) {
		myUserDAOImpl.deleteMyUserById(userId);
	}

	@Override
	@Transactional(propagation=Propagation.REQUIRED)
	public void reviseMyUser(MyUser myUser) {
		myUserDAOImpl.updateMyUser(myUser);
	}

	@Override
	public MyUser getMyUser(long userId) {
		return myUserDAOImpl.selectMyUserById(userId);
	}
}
